<?php

namespace frontend\controllers;


use app\models\Bank;
use Yii;
use yii\web\Controller;


/**
 * Text controller
 */
class BankController extends Controller
{
    public $enableCsrfValidation = false;

    //授信管理列表
    public function actionCreditlist()
    {
        $get = Yii::$app->request->get();
        $model = new Bank();
        $res = $model->credit($get);
        return json_encode($res);

    }
    //绑定银行卡
    public function actionBindcard()
    {
        $post = Yii::$app->request->post();
        $model = new Bank();
        $res = $model->bindcard($post);
        if ($res['code'] == 200) {
            return json_encode($res);
        } else {
            return json_encode(['code' => 401, 'message' => '绑定失败！', 'data' => '']);
        }

    }


    //查看银行卡详情
    public function actionCheckcard()
    {
        $get = Yii::$app->request->get();
        $model = new Bank();
        $date = $model->cardcheck($get);
        if ($date['code'] == 200) {
            return json_encode($date);
        } else {
            return json_encode(['code' => 401, 'message' => '绑定失败！', 'data' => '']);
        }
    }

    //修改银行卡
    public function actionUpdatecard()
    {
        $post = Yii::$app->request->post();
        $model = new Bank();
        $res = $model->cardupdate($post);
        if ($res['code'] == 200) {
            return json_encode($res);
        } else {
            return json_encode(['code' => 401, 'message' => '修改失败！', 'data' => '']);
        }
    }

  



}
